const app = getApp()
const $api = require('../../utils/api.js').API;
var WxParse = require('../../wxParse/wxParse.js');
Page({
    data: {
        list:{},
        imgUrl:app.globalData.imgUrl,
        video:'',
        name:'',
        vId:0
    },
    onLoad: function(){
      this.getList()
    },
    getList:function(){
      var that = this
      var data = {}
      $api.get('explain/list',data).then(res => {
        //请求成功
        if(res.data.code == 1){
          var list = res.data.data
          that.setData({
            list:list,
            video:list[0]['video'],
            name:list[0]['name'],
            vId:list[0]['id']
          })
        }
      })
    },
    editId:function(e){
      var key = e.currentTarget.dataset.key
      if(this.data.vId == key){
        return;
      }
      var list = this.data.list
      this.setData({
        vId:key,
        name:list[key].name,
        video:list[key].video
      })
    },
    onShareAppMessage: function() {
      return {
          title: "天意美业直通车",
          path: "/pages/index/index?puid="+wx.getStorageSync('uid')
      };
    }
});